import axios from './axios';

interface ICatDTO {
  id: string;
  name: string;
  age: number;
  breed: string;
}

export const createCat = (cat: Partial<ICatDTO>) => {
  return axios.post('/books', cat);
};

export const updateCat = (cat: Partial<ICatDTO>) => {
  return axios.put('/books', cat);
};

export const removeCat = (id: string) => {
  return axios.delete(`/books/${id}`);
};

interface GetCatsParams {
  name?: string;
  type?: string;
  description?: string;
  current: number;
  pageSize: number;
}

export const getCats = (params: GetCatsParams) => {
  return axios.get('/books', { params });
};

export const getCat = (id: string) => {
  return axios.get(`/books/${id}`);
};
